﻿// 3. We are given a matrix of strings of size N x M. Sequences in the matrix we define as sets of several neighbor elements located
// on the same line, column or diagonal. Write a program that finds the longest sequence of equal strings in the matrix.

using System;

class SequenceInMatrix 
{
    static void Main()
    {
        // get the row number of the matrix
        Console.Write("Enter the number of rows of the matrix : ");
        string rowsStr = Console.ReadLine();
        int rows;
        while (!int.TryParse(rowsStr, out rows))
        {
            Console.Write("Invalid input. Enter again the number of rows of the matrix : ");
            rowsStr = Console.ReadLine();
        }

        // get the column number of the matrix
        Console.Write("Enter the number of columns of the matrix : ");
        string columnsStr = Console.ReadLine();
        int cols;
        while (!int.TryParse(columnsStr, out cols))
        {
            Console.Write("Invalid input. Enter again the number of columns of the matrix : ");
            columnsStr = Console.ReadLine();
        }

        // define the matrix
        string[,] matrix = new string[rows, cols];
        // enter values for the cells
        Console.WriteLine("Enter the cells of the matrix:");
        for (int row = 0; row < rows; row++)
        {
            for (int col = 0; col < cols; col++)
            {
                Console.Write("matrix[{0},{1}] = ", row, col);
                matrix[row, col] = Console.ReadLine();
            }
        }

        //int line = 0;
        //int column = 0;
        //int diagonal = 0;
        //int maxLength = 0;

    }
}
